﻿using System;
using UnityEngine;
using UnityEngine.EventSystems;

// 点击了场景(界面)
public class TouchScene
{
    // 当点击了场景中的某个物体
    public Action<Vector3> OnTouchSth;

    public void Init()
    {
        var root = UIManager.instance.AddUI("UI/FightScene/TouchScene", UILayer.Touch);

        var touch = root.AddComponent<TouchEx>();

        touch.OnPointerDownCallback = onTouchScene;
    }

    // 触摸了UI上的空白部分
    private void onTouchScene(PointerEventData eventData)
    {
        if (OnTouchSth != null) { OnTouchSth(Input.mousePosition); }
    }
}
